#include<iostream>
#include<string>
void SubStrNum(std::string ss1, std::string ss2)
{
	int i, j, num = 0;
	for ( i = 0; i < ss1.size(); i++) {
		int flag = 1;
		for (j = 0; j < ss2.size(); j++) {
			if (ss1[i + j] != ss2[j]) {
				flag = 0;
			}
		}
		if (flag == 1) {
			num++;
			i += ss2.size() -1;
		}
	}
	std::cout << "命中次数=" << num;
}
int main()
{
	std::string s1("abcdedede"), s2("de");
	std::cout << "初始字符串:" << s1 << std::endl;
	std::cout << "比较字符串:" << s2 << std::endl;
	SubStrNum(s1, s2);
	return 0;
}
